package com.wd.rim.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import apdate.SquareApdate
import apdate.TalkApdate
import com.wd.common.base.BaseFragment
import com.wd.common.viewmodel.MyViewModel
import com.wd.rim.R
import com.wd.rim.databinding.FragmentJoinPostBinding


class JoinPostFragment : BaseFragment<FragmentJoinPostBinding>(){
    private val mviewmodel: MyViewModel by viewModels()
    private var apdate:SquareApdate?=null
    override fun getViewBinding(
        inflater: LayoutInflater,
        container: ViewGroup?
    ):FragmentJoinPostBinding=FragmentJoinPostBinding.inflate(layoutInflater)
    override fun initData() {
        mviewmodel.getRecom(1,10)
        mviewmodel.Recom.observe(this){
            if (it.status.equals("110")){
                Toast.makeText(context,it.message, Toast.LENGTH_SHORT)
            }else{
                apdate=context?.let {it1-> SquareApdate(it1,it) }
                binding.joinpostrec.layoutManager= LinearLayoutManager(context)
                binding.joinpostrec.adapter=apdate
            }
        }
    }

}